//
//  HELService.m
//  NursingAssociation
//
//  Created by wsj2015 on 2017/3/10.
//  Copyright © 2017年 wsj2015. All rights reserved.
//

#import "HELService.h"

@implementation HELService



#pragma -mark 请求 上传 上传时长

+ (void)uploadVedioProgress:(NSDate *)beginDate withcourseId:(NSInteger)courseId withContentId:(NSInteger)contentId couserStatus:(NSString* )courseStatus withContent:(NSInteger )contentStatu{
    
    //课程的status为未参加时，子项目islock为true可以点击，但不要去上传进度，会影响后台状态。
    if ([courseStatus containsString:@"未参加"] &&  contentStatu ==1) {
        return;
    }
    
    //没有播放  后者 课程状态 为 评分之前,则不需要上传
    if ([courseStatus containsString:@"已完成"] ) {
        return;
    }
    NSMutableDictionary *params =[NSMutableDictionary
                                  dictionary];
    
    
    
    NSDate *endDate =[NSDate date];
    long long seconds = [endDate timeIntervalSinceDate:beginDate];
    
    params[@"progress"] =@(seconds);
    params[@"courseId"] = @(courseId) ;
    params[@"subcourseId"] =  @(contentId);
    
    
    
 
   
    [[HELNetworkManager sharedMg] PUT:kUploadLearningProgress parameters:params progress:nil success:^(id response) {
        NSString *jindu =[NSString stringWithFormat:@"进度为%@",@(seconds)];
//        WSJ_Alert(@"调试模式_上传进度成功", jindu);
        
    } failure:^(NSString *err) {
        
    }];
    
    
}


#pragma -mark 请求 上传 上传时长

+ (void)uploadPdfPage:(NSInteger)page withcourseId:(NSInteger)courseId withContentId:(NSInteger)contentId couserStatus:(NSString* )courseStatus withContent:(NSInteger )contentStatu{
   
    //课程的status为未参加时，子项目islock为true可以点击，但不要去上传进度，会影响后台状态。
    if ([courseStatus containsString:@"未参加"] &&  contentStatu ==1) {
        return;
    }
    
    //没有播放   课程状态 为 评分之前,则不需要上传
    if ([courseStatus containsString:@"已完成"] ) {
        return;
    }
    NSMutableDictionary *params =[NSMutableDictionary
                                  dictionary];
    params[@"progress"] =@(page);
    params[@"courseId"] =@(courseId) ;
    params[@"subcourseId"] =  @(contentId);
    
    
    [[HELNetworkManager sharedMg] PUT:kUploadLearningProgress parameters:params progress:nil success:^(id response) {
//        NSString *jindu =[NSString stringWithFormat:@"进度为%@",@(page)];
//         WSJ_Alert(@"调试模式_上传进度成功", jindu);
    } failure:^(NSString *err) {
        
    }];
    
    
}

@end
